// function(){
// 显示同盾查询列表
  let operationType,startDate,endDate,invokeMode,decision,searchCat,searchValue,ruleName,group,minScore,maxScore,UIListView;

  apiready = function(){
          //初始化窗体
          settime();
          iniFrom();
        	addData();
  }

  function iniFrom(){
    operationType=api.pageParam.operationType;
    startDate=api.pageParam.startDate;
    endDate=api.pageParam.endDate;
    invokeMode=api.pageParam.invokeMode;
    decision=api.pageParam.decision;
    searchCat=api.pageParam.searchCat;
    searchValue=api.pageParam.searchValue;
    ruleName=api.pageParam.ruleName;
    group=api.pageParam.group;
    minScore=api.pageParam.minScore;
    maxScore=api.pageParam.maxScore;
    UIListView = api.require('UIListView');
    UIListView.open({
        rect: {
            x: 0,
            y: 0,
            w: api.winWidth,
            h: api.frameHeight
        },
        data: [],
        rightBtns: [{
            bgColor: '#388e8e',
            activeBgColor: '',
            width: 70,
            title: '按钮',
            titleSize: 12,
            titleColor: '#fff',
            icon: '',
            iconWidth: 20
        }],
        styles: {
            borderColor: '#696969',
            item: {
                bgColor: '#AFEEEE',
                activeBgColor: '#F5F5F5',
                height: 55.0,
                imgWidth: 40,
                imgHeight: 40,
                imgCorner: 4,
                placeholderImg: '',
                titleSize: 12.0,
                titleColor: '#000',
                subTitleSize: 12.0,
                subTitleColor: '#000',
                remarkColor: '#000',
                remarkSize: 16,
                remarkIconWidth: 30
            }
        },
        fixedOn: api.frameName
    }, function(ret, err) {
        if (ret) {
            console.log(JSON.stringify(ret));
          if(ret.eventType=="clickContent"){
            console.log(JSON.stringify(ret));
            UIListView.getDataByIndex({
        				index : ret.index
        			}, function(ret1, err) {
        				if (ret1) {
                  console.log(JSON.stringify(ret1));
                  console.log( ret1.data.uid);
                  api.openWin({
              	    name: 'tongDunReport',
              	    url: 'tongDunReport.html',
                    pageParam: {report_id: ret1.data.uid}
                  })
        				}
        			});
            }
        }
    });
    UIListView.setRefreshFooter({
      bgColor : '#F5F5F5',
      textColor : '#8E8E8E'
    }, function(ret, err) {
      if (ret) {
        addData();
      } else {
        alert(JSON.stringify(err));
      }
    });
  }

//构建查询条件
  function createQueryUrl(){
    var  curPage=$api.val($api.byId('curPage'));
    var  pageSize=$api.val($api.byId('pageSize'));
    var totalPage=$api.val($api.byId('totalPage'));
    if(!pageSize && pageSize=="") pageSize=20;
    if(!curPage && curPage=="")
      curPage=1;
    else
      curPage=parseInt(curPage)+1;
    if(totalPage && curPage>totalPage)
      return ""
    else
      return "operationType=queryReportList" +
                "&curPage=" + curPage +
                "&pageSize=" + pageSize +
                "&begin_time=" + startDate +
                "&end_time=" + endDate +
                "&invoke_mode=" + invokeMode +
                "&decision=" + decision +
                "&search_cat=" + searchCat +
                "&search_value=" + searchValue +
                "&rule_name=" + ruleName +
                "&group=" + group +
                "&min_score=" + minScore +
                "&max_score=" + maxScore ;
        }


  //添加数据
  function addData(){
    var queryStr=createQueryUrl();
    if(queryStr){
    // 提交JSON数据
    api.ajax({
      url: 'http://'+sourceIp+':20099/tongdun/getListInfo?'+queryStr,
      method: 'get',
      headers: {'Content-Type': 'application/json;charset=utf-8'}
    },function(ret, err) {
        if (ret) {
          var listInfo=ret.data.listInfo;
          var datas=[];
          for(var i=0;i<listInfo.length;i++){
            var item={};
              item.uid=listInfo[i].value;
              item.title=listInfo[i].dataName;
              item.subTitle=listInfo[i].dateTime;
              item.remark=listInfo[i].score;
              datas.push(item)
            }
            if(!$api.hasCls($api.byId('coverPage'), 'hide')){
              $api.addCls($api.byId('coverPage'), 'hide');
            }
          if(datas.length>0){
            UIListView.appendData({data: datas});
            $api.val($api.byId('pageSize'),ret.data.pageSize);
            $api.val($api.byId('totalPage'),ret.data.totalPage);
            $api.val($api.byId('curPage'),ret.data.curPage);
          }
          else{
            if($api.hasCls($api.byId('noData'), 'hide')){

              $api.html($api.byId('errMsg'),"查询无数据");
              $api.removeCls($api.byId('noData'), 'hide');
            }
          }
        }
        else {
          if($api.hasCls($api.byId('noData'), 'hide')){
              $api.html($api.byId('errMsg'),"网络请求超时，请稍后重试")
            $api.removeCls($api.byId('noData'), 'hide');
          }

        }
      });
    }
  }
